package eai.tp2.shippingdepartment;

import java.util.Random;

import eai.tp2.shippingdepartment.startshippingclient.StartShippingService;


public class Timer implements Runnable {

	int numOrder;

	public Timer(int numOrder) {
		this.numOrder = numOrder;
	}

	@Override
	public void run() {
		Random random = new Random();
		int time = 3+random.nextInt(5);
		try {
			Thread.sleep(time * 1000);
			System.out.println("Ordem processada");
			StartShippingService wsclient = new StartShippingService();
			wsclient.getStartShippingPort().orderProcessed(numOrder);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}